﻿@model PageList<ProjectListModel>
@{
    ViewBag.Title = "工程列表";
}
@section BodyNav
{
    > @Html.ActionLink("工程列表", "List", "Project")
}
<table class="list">
    <tr class="head">
        <th>
        </th>
        <th width="190">
            工程操作
        </th>
        <th>
            工程名称
        </th>
        <th>
            设备备案号
        </th>
        <th>
            设备报检号
        </th>
        <th>
            设备合格证号
        </th>
        <th>
            检测时间
        </th>
        <th>
            检测情况
        </th>
        <th>
            准运证领取情况
        </th>
    </tr>
    @if (Model != null)
    {
        foreach (var t in Model)
        {
        <tr @Html.Raw((t.NearlyExpired ? "class=\"nearlyExpired\"" : "")) @Html.Raw((t.HasBeenExpired ? "class=\"Expired\"" : ""))>
            <td>@Html.CheckBox("Id", new { value = t.Id })
            </td>
            <td>
                @Html.ActionLink("查看", "Detail", new { Id = @t.Id }, new { @class = "lnkDetail" })
                @if (UserAuthnicationHelper.CurrentUserType >= UserTypes.Operator)
                {
                    if (t.ShowInspectResultLink)
                    {
                    @Html.ActionLink("检测结果", "InspectResultEdit", new { Id = @t.Id }, new { @class = "LnkNormal" })
                    }
                    if (t.ShowApplyLink)
                    {
                    @Html.ActionLink("领证", "Apply", new { Id = @t.Id }, new { @class = "LnkNormal" })
                    }
                    @Html.ActionLink("修改", "Edit", new { Id = @t.Id }, new { @class = "lnkEdit" })
                    @Html.ActionLink("删除", "Delete", new { Id = @t.Id }, new { @class = "lnkDel" })
                    if (t.Status != ProjectStatus.Destroyed)
                    {
                    @Html.ActionLink("报拆", "Destory", new { Id = @t.Id }, new { @class = "LnkDestory" })
                    }
                    if (t.Status != ProjectStatus.Destroyed && t.NearlyExpired)
                    {
                    @Html.ActionLink("续检", "InspectAgain", new { Id = @t.Id }, new { @class = "LnkNormal" })
                    }
                }
            </td>
            <td>
                @t.Name
            </td>
            <td>@t.EquipmentNo
            </td>
            <td>@t.InspectNO
            </td>
            <td>@t.EquipmentCertNo
            </td>
            <td>@t.InspectTime
            </td>
            <td>@t.InspectResultString
            </td>
            <td>@t.HasPrintedString
            </td>
        </tr>
        }
    }
</table>
<div class="pager">
    @Html.Raw(Html.Pager("page", Model.PageIndex, Model.PageSize, Model.TotalCount))
    @if (Model != null && Model.Count > 0)
    {
        RouteValueDictionary dic = new RouteValueDictionary(ViewContext.RouteData.Values);
        Array.ForEach(Request.QueryString.AllKeys,t=>dic.Add(t,Request.QueryString[t]));
        dic.Remove("page");
        @Html.ActionLink("导出", "Export", "Project",dic, null)
    }
</div>
